import java.util.*;
class PersonOverride{
	private String name;
	private boolean gender;
	private int age;
	public PersonOverride(){
		this("default",1,true);
	}
	public PersonOverride(String name,int age,boolean gender){
		this.name=name;
		this.age=age;
		this.gender=gender;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public boolean isGender() {
		return gender;
	}
	public void setGender(boolean gender) {
		this.gender = gender;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	
	public String toString() {
		return String.format("%s-%s-%s", name,age,gender);
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		PersonOverride other = (PersonOverride) obj;
		if (age != other.age)
			return false;
		if (gender != other.gender)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
}
public class Main {
   public static void main(String[] args){
	   Scanner in=new Scanner(System.in);
	   while(in.hasNext()){
		 int n1=in.nextInt();
		 PersonOverride[] person1=new PersonOverride[n1];
		 for (int i = 0; i < person1.length; i++) {
			 person1[i]=new PersonOverride();	
			 System.out.println(person1[i]);
		}
		int n2=in.nextInt(),count=0;
	    ArrayList<PersonOverride> person2=new ArrayList<PersonOverride>(n2);
		for (int i = 0; i <n2; i++) {
			    PersonOverride person=new PersonOverride(in.next(), in.nextInt(), in.nextBoolean());
			    if(!person2.contains(person)){
			    	person2.add(person);count++;
			    }
		}
		 for (int i = 0; i < person2.size(); i++) {
			System.out.println(person2.get(i));
		}
		System.out.println(count);
		System.out.println(Arrays.toString(PersonOverride.class.getConstructors()));
	   }
	   in.close();
   }
}